package Server;

import Factory.GradeFactory;
import dao.GradeDao;
import user.Grade;

import java.sql.SQLException;
import java.util.List;

public class GradeServer {

    private GradeDao gradeDao;

    public GradeServer(){
        this.gradeDao= GradeFactory.getGradeDao();
    }

    public int addGradeServer(Grade grade) throws SQLException {
        return gradeDao.addGrade(grade);
    }

    public int deleteGradeServer(String num) throws SQLException {
        return gradeDao.deleteGrade(num);
    }

    public int motifyGradeServer(String num,Grade grade) throws SQLException {
        return gradeDao.motifyGrade(num,grade);
    }

    public Grade findGradeServer(String num) throws SQLException {
        return gradeDao.findGrade(num);
    }

    public int countGradeServer() throws SQLException {
        return gradeDao.countGrade();
    }

    public List<Grade> getGradeServer(String star,String end) throws SQLException {
        return gradeDao.getGrade(star,end);
    }

    public Grade findGradeByNameServer(String num) throws SQLException {
        return gradeDao.findGradeByName(num);
    }

    public int countStudentServer(String num) throws SQLException {
        return gradeDao.countStudent(num);
    }

}
